package core

import (
	"gitee.com/gopher2011/gin"
	"gitee.com/gopher2011/mall/middleware"
	"gitee.com/gopher2011/mall/router"
)

// 初始化总路由
func Routers() *gin.Engine {
	r := gin.New()

	// 跨域
	r.Use(middleware.Cors())

	//Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

	// 方便统一添加路由组前缀 多服务器上线使用
	//PublicGroup := r.Group("")
	//{
	//	router.Base(PublicGroup) // 注册基础功能路由 不做鉴权
	//}
	PrivateGroup := r.Group("")
	{
		router.UmsAdmin(PrivateGroup)
		router.UmsRole(PrivateGroup)
		router.UmsResource(PrivateGroup)
		router.UmsMenu(PrivateGroup)
		router.UmsMemberLevel(PrivateGroup)
		router.SmsCoupon(PrivateGroup)
		router.SmsCouponHistory(PrivateGroup)
		router.SmsFlashPromotion(PrivateGroup)
		router.SmsFlashPromotionProductRelation(PrivateGroup)
		router.SmsFlashPromotionSession(PrivateGroup)
		router.SmsHomeAdvertise(PrivateGroup)
		router.UmsResourceCategory(PrivateGroup)
		router.SmsHomeBrand(PrivateGroup)
		router.SmsHomeNewProduct(PrivateGroup)
		router.SmsHomeRecommendProduct(PrivateGroup)
		router.SmsHomeRecommendSubject(PrivateGroup)
		router.PmsBrand(PrivateGroup)
		router.PmsProductAttribute(PrivateGroup)
		router.PmsProductAttributeCategory(PrivateGroup)
	}
	return r
}
